package com.yaolifei.flower.model.service;

import java.util.List;

import com.yaolifei.flower.model.Model;
import com.yaolifei.flower.model.ModelColumn;

public interface ModelService {
	
	// ------------------- model api ----------------------------
	Model addModel(Model model);

	void deleteModel(int modelId);

	void updateModel(Model model);

	Model getModel(int modelId);

	List<Model> getTopModels();

	List<Model> getChildren(int parentId);

	void buildModelTable(int modelId);

	void buildModelTable(Model model);

	void dropModelTable(int modelId);

	void dropModelTable(Model model);

	// ---------------------- column api ------------------------------
	List<ModelColumn> getModelColumnList(int modelId);

	ModelColumn getModelColumn(int columnId);
	
	List<ModelColumn> getModelColumn(int... columnId);

	ModelColumn getModelColumn(int modelId, String physicalName);

	void addModelColumn(ModelColumn column);

	void deleteModelColumn(int columnId);

	int getColumnCount(int modelId);

	/**
	 * 如果column已经构建将同步修改物理表
	 * @param column
	 */
	void updateModelColumn(ModelColumn column);

	void buildModelColumn(int... columnId);

	void buildModelColumn(ModelColumn... column);
	
	void rebuildModelColumn(String oldPhysicalColumnName, ModelColumn column);

	void dropModelColumn(ModelColumn column);

	void dropModelColumn(int columnId);

}
